Thread: Error in memcpy [solved]

  1. #1
    Registered User
    Join Date
    Sep 2018
    Posts
    1

    Error in memcpy [solved]

    I made the same mistake as a previous post, and searching for an answer found this:
    Error in memcpy

    Code:
    DWORD CodeItem;
    memcpy(&CodeItem,szItemTrig,4);
    I had the same errors:


    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    error C2365: 'memcpy' : redefinition; previous definition was 'function'
    c:\program files\microsoft visual studio 9.0\vc\include\string.h(53) : see declaration of 'memcpy'
    error C2078: too many initializers

    [solution]

    The problem is trying to use memcpy to construct a global var in global space. To solve this move memcpy to a function, and call that function to get the global.

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    To solve this move memcpy to a function, and call that function to get the global.
    No to solve the problem don't use global variables.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pipe cmd.exe (solved)
    By Foxy999 in forum C Programming
    Replies: 1
    Last Post: 06-29-2010, 06:32 PM
  2. Error in memcpy
    By darkai in forum C++ Programming
    Replies: 2
    Last Post: 12-02-2008, 10:09 AM
  3. solved , don't look
    By Nutshell in forum C Programming
    Replies: 3
    Last Post: 01-13-2002, 11:42 AM

Tags for this Thread